<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>编辑</title>
</head>
<style>
    *{font-size: 12px; margin-top:0.2em}
    input{width:50%}
</style>

<body>
<form th:method="POST" th:action="@{/admin/dsSave}">
    <div th:if="${not #strings.isEmpty(ds.dsId)}">
        <input type="hidden" name="dsId" th:value="${ds.dsId}"/>
    </div>
    <div th:object="${ds}">
        <div>
            <laber>数据源编码*</laber>
            <input th:type="text" name="dsCode" th:value="*{dsCode}"/>
        </div>
        <div>
            <laber>数据源名称*</laber>
            <input th:type="text" name="dsName" th:value="*{dsName}"/>
        </div>
        <div>
            <laber>数据源描述</laber>
            <input th:type="text" name="dsDesc" th:value="*{dsDesc}"/>
        </div>
        <div>
            <laber>数据库类型</laber>
            <input th:type="text" name="dsType" th:value="*{dsType}"/>
        </div>
        <div>
            <laber>jdbc_url*</laber>
            <input th:type="text" name="jdbcUrl" th:value="*{jdbcUrl}"/>
        </div>
        <div>
            <laber>username*</laber>
            <input th:type="text" name="username" th:value="*{username}"/>
        </div>
        <div>
            <laber>password*</laber>
            <input th:type="text" name="password" th:value="*{password}"/>
        </div>
        <div>
            <laber>driver_class*</laber>
            <input th:type="text" name="driverName" th:value="*{driverName}"/>
        </div>
        <div>
            <laber>其它参数</laber>
            <input th:type="text" name="dsParams" th:value="*{dsParams}"/>
        </div>
        <div>
            <laber>有效状态*</laber>
            <select name="state"/>
                <option id="succ" value="1">有效</option>
                <option id="fail" value="0">无效</option>
            </select>
        </div>
        <button th:type="submit">保存</button>
    </div>
</form>
</body>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    document.addEventListener('DOMContentLoaded',
        function(){
            var succ = document.getElementById("succ");
            var fail = document.getElementById("fail");
            var i = [[${ds.state}]];
            if (i == 1) {
                succ.selected = true;
            } else {
                fail.selected = true;
            }
        },
        false);
    /*]]>*/
</script>
</html>
